﻿using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.Utilities;

namespace HardcoreGame.Content.NPCs.Enemies.Variant.Zombies
{
    public class SlimeZombie : ModNPC
    {
        public override void SetStaticDefaults()
        {
            Main.npcFrameCount[Type] = Main.npcFrameCount[NPCID.SlimedZombie];
            NPCID.Sets.NPCBestiaryDrawModifiers value = new()
            {
                Velocity = 1f
            };
            NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, value);
        }
        public override void SetDefaults()
        {
            AIType = NPCID.SlimedZombie;
            AnimationType = NPCID.SlimedZombie;
            Banner = Item.NPCtoBanner(NPCID.SlimedZombie);
            BannerItem = Item.BannerToItem(Banner);
            NPC.width = 18;
            NPC.height = 40;
            NPC.aiStyle = 3;
            NPC.damage = 13;
            NPC.defense = 6;
            NPC.lifeMax = 40;
            NPC.HitSound = SoundID.NPCHit1;
            NPC.DeathSound = SoundID.NPCDeath2;
            NPC.knockBackResist = 0.55f;
            NPC.value = 55f;
            Banner = NPC.type;
            BannerItem = ItemID.ZombieBanner;
        }
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void HitEffect(NPC.HitInfo hit)
        {
            if (NPC.life > 0)
            {
                for (int num533 = 0; num533 < 10 / (double)NPC.lifeMax * 100.0; num533++)
                {
                    Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f);
                }
            }
            if (NPC.life <= 0)
            {
                for (int i = 0; i < 20; i++)
                {
                    Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2.5f * hit.HitDirection, -2.5f, 0, default, 0.7f);
                }
                var entitySource = NPC.GetSource_Death();
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 3, 1f);
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 4, 1f);
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 5, 1f);
            }
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie1 : SlimeZombie
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneNormalUnderground && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
    }
    public class SlimeZombie2 : SlimeZombie
    {

    }
    public class SlimeZombie3 : SlimeZombie2
    {

    }
    public class SlimeZombie4 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneNormalCaverns && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
        {
            if (Main.rand.NextFloat() < 0.25f)
            {
                target.AddBuff(BuffID.Darkness, 60 * 15);
            }
        }
    }
    public class SlimeZombie5 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneSnow && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
        {
            if (Main.rand.NextFloat() < 0.083f)
            {
                target.AddBuff(46, 60 * 10);
            }
        }
    }
    public class SlimeZombie6 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneUndergroundDesert && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundDesert,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
    }
    public class SlimeZombie7 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneJungle && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
    }
    public class SlimeZombie8 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneSnow && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Snow,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
        {
            target.AddBuff(46, 60 * 20);
        }
        public override void AI()
        {
            if (NPC.localAI[0] > 0f)
            {
                NPC.localAI[0] -= 1f;
            }
            if (!NPC.wet && !Main.player[NPC.target].npcTypeNoAggro[NPC.type])
            {
                Vector2 vector2 = new(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
                float num13 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector2.X;
                float num14 = Main.player[NPC.target].position.Y - vector2.Y;
                float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
                if (Main.expertMode && num15 < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f)
                {
                    NPC.ai[0] = -40f;
                    if (NPC.velocity.Y == 0f)
                    {
                        NPC.velocity.X *= 0.9f;
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] == 0f)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            Vector2 vector3 = new(i - 2, -4f);
                            vector3.X *= 1f + Main.rand.Next(-50, 51) * 0.005f;
                            vector3.Y *= 1f + Main.rand.Next(-50, 51) * 0.005f;
                            vector3.Normalize();
                            vector3 *= 4f + Main.rand.Next(-50, 51) * 0.01f;
                            int attackDamage_ForProjectiles = NPC.GetAttackDamage_ForProjectiles(9f, 9f);
                            Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2.X, vector2.Y, vector3.X, vector3.Y, 174, attackDamage_ForProjectiles, 0f, Main.myPlayer);
                            NPC.localAI[0] = 30f;
                        }
                    }
                }
                else if (num15 < 200f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f)
                {
                    NPC.ai[0] = -40f;
                    if (NPC.velocity.Y == 0f)
                    {
                        NPC.velocity.X *= 0.9f;
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] == 0f)
                    {
                        num14 = Main.player[NPC.target].position.Y - vector2.Y - Main.rand.Next(0, 200);
                        num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
                        num15 = 4.5f / num15;
                        num13 *= num15;
                        num14 *= num15;
                        NPC.localAI[0] = 50f;
                        Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2.X, vector2.Y, num13, num14, 174, 9, 0f, Main.myPlayer);
                    }
                }
            }
        }
    }
    public class SlimeZombie9 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneJungle && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo)
        {
            target.AddBuff(46, 60 * 20);
        }
        public override void AI()
        {
            if (NPC.localAI[0] > 0f)
            {
                NPC.localAI[0] -= 1f;
            }
            if (!NPC.wet && !Main.player[NPC.target].npcTypeNoAggro[NPC.type])
            {
                Vector2 vector2 = new(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
                float num13 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector2.X;
                float num14 = Main.player[NPC.target].position.Y - vector2.Y;
                float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
                if (Main.expertMode && num15 < 120f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f)
                {
                    NPC.ai[0] = -40f;
                    if (NPC.velocity.Y == 0f)
                    {
                        NPC.velocity.X *= 0.9f;
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] == 0f)
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            Vector2 vector3 = new(i - 2, -4f);
                            vector3.X *= 1f + Main.rand.Next(-50, 51) * 0.005f;
                            vector3.Y *= 1f + Main.rand.Next(-50, 51) * 0.005f;
                            vector3.Normalize();
                            vector3 *= 4f + Main.rand.Next(-50, 51) * 0.01f;
                            int attackDamage_ForProjectiles = NPC.GetAttackDamage_ForProjectiles(9f, 9f);
                            Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2.X, vector2.Y, vector3.X, vector3.Y, 176, attackDamage_ForProjectiles, 0f, Main.myPlayer);
                            NPC.localAI[0] = 30f;
                        }
                    }
                }
                else if (num15 < 200f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && NPC.velocity.Y == 0f)
                {
                    NPC.ai[0] = -40f;
                    if (NPC.velocity.Y == 0f)
                    {
                        NPC.velocity.X *= 0.9f;
                    }
                    if (Main.netMode != NetmodeID.MultiplayerClient && NPC.localAI[0] == 0f)
                    {
                        num14 = Main.player[NPC.target].position.Y - vector2.Y - Main.rand.Next(0, 200);
                        num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
                        num15 = 4.5f / num15;
                        num13 *= num15;
                        num14 *= num15;
                        NPC.localAI[0] = 50f;
                        Projectile.NewProjectile(NPC.GetSource_FromAI(), vector2.X, vector2.Y, num13, num14, 176, 9, 0f, Main.myPlayer);
                    }
                }
            }
        }
    }
    public class SlimeZombie10 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneNormalCaverns && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.25f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnKill()
        {
            int num324 = Main.rand.Next(2) + 2;
            for (int num325 = 0; num325 < num324; num325++)
            {
                int num326 = NPC.NewNPC(NPC.GetSource_OnHurt(null), (int)(NPC.position.X + NPC.width / 2), (int)(NPC.position.Y + NPC.height), 1);
                Main.npc[num326].SetDefaults(ModContent.NPCType<SlimeZombie11>());
                Main.npc[num326].velocity.X = NPC.velocity.X * 2f;
                Main.npc[num326].velocity.Y = NPC.velocity.Y;
                Main.npc[num326].velocity.X += Main.rand.Next(-20, 20) * 0.1f + num325 * NPC.direction * 0.3f;
                Main.npc[num326].velocity.Y -= Main.rand.Next(0, 10) * 0.1f + num325;
                Main.npc[num326].ai[0] = -1000 * Main.rand.Next(3);
                if (Main.netMode == NetmodeID.Server && num326 < 200)
                {
                    NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num326);
                }
            }
        }
    }
    public class SlimeZombie11 : SlimeZombie2
    {
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
    }
    public class SlimeZombie12 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneUnderworldHeight && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }
        public override void AI()
        {
            NPC.lavaImmune = true;
        }
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheUnderworld,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void OnKill()
        {
            if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient && !Main.remixWorld)
            {
                int num430 = (int)(NPC.Center.X / 16f);
                int num431 = (int)(NPC.Center.Y / 16f);
                if (!WorldGen.SolidTile(num430, num431) && Main.tile[num430, num431].LiquidAmount == 0)
                {
                    Tile tile = Main.tile[num430, num431];
                    tile.LiquidAmount = (byte)Main.rand.Next(50, 150);
                    tile.LiquidType = LiquidID.Lava;
                    WorldGen.SquareTileFrame(num430, num431);
                }
            }
        }
    }
    public class SlimeZombie13 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneDungeon && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.2f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheDungeon,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
            npcLoot.Add(ItemDropRule.Common(ItemID.GoldenKey, 1, 1, 1));
        }
    }
    public class SlimeZombie14 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.05f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
            npcLoot.Add(ItemDropRule.Common(ItemID.PinkGel, 1, 25, 50));
        }
    }
    public class SlimeZombie15 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime && Main.halloween)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie16 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime && Main.xMas)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie17 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime && Main.xMas)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie18 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime && Main.xMas)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie19 : SlimeZombie2
    {
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneOverworldHeight && !Main.dayTime && Main.xMas)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.3f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
        }
    }
    public class SlimeZombie20 : ModNPC
    {
        public override void SetStaticDefaults()
        {
            Main.npcFrameCount[Type] = 15;
            NPCID.Sets.NPCBestiaryDrawModifiers value = new()
            {
                Velocity = 1f
            };
            NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, value);
        }
        public override void SetDefaults()
        {
            AIType = NPCID.SlimedZombie;
            AnimationType = NPCID.SlimedZombie;
            Banner = Item.NPCtoBanner(NPCID.SlimedZombie);
            BannerItem = Item.BannerToItem(Banner);
            NPC.width = 18;
            NPC.height = 40;
            NPC.aiStyle = 3;
            NPC.damage = 13;
            NPC.defense = 6;
            NPC.lifeMax = 40;
            NPC.HitSound = SoundID.NPCHit1;
            NPC.DeathSound = SoundID.NPCDeath2;
            NPC.knockBackResist = 0.55f;
            NPC.value = 55f;
            Banner = NPC.type;
            BannerItem = ItemID.ZombieBanner;
        }
        public override float SpawnChance(NPCSpawnInfo spawnInfo)
        {
            if (spawnInfo.Player.ZoneHallow && !Main.dayTime && Main.raining)
            {
                return SpawnCondition.OverworldNightMonster.Chance * 0.02f;
            }
            return 0f;
        }

        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            bestiaryEntry.Info.AddRange([
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Events.Rain,
                new FlavorTextBestiaryInfoElement("Mods.HardcoreGame.Bestiary.SlimeZombie"),
            ]);
        }
        public override void HitEffect(NPC.HitInfo hit)
        {
            if (NPC.life > 0)
            {
                for (int num533 = 0; num533 < 10 / (double)NPC.lifeMax * 100.0; num533++)
                {
                    Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f);
                }
            }
            if (NPC.life <= 0)
            {
                for (int i = 0; i < 20; i++)
                {
                    Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2.5f * hit.HitDirection, -2.5f, 0, default, 0.7f);
                }
                var entitySource = NPC.GetSource_Death();
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 3, 1f);
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 4, 1f);
                Gore.NewGore(entitySource, NPC.position, NPC.velocity, 5, 1f);
            }
        }
        public override void ModifyNPCLoot(NPCLoot npcLoot)
        {
            var zombieDropRules = Main.ItemDropsDB.GetRulesForNPCID(NPCID.SlimedZombie, false);
            foreach (var zombieDropRule in zombieDropRules)
            {
                npcLoot.Add(zombieDropRule);
            }
            npcLoot.Add(ItemDropRule.Common(ItemID.RainbowBrick, 1, 1, 20));
        }
    }
}
